PRB9: Rapper Math Part 2! // Beginner

 
Jay-Z and G-Eazy were recently arguing over whose one letter suffix/prefix was better. Eventually, the argument reached a stalemate, and they both decided to end it through a test of intelligence. Jay- Z asked G-Eazy if given an array of integers he could find out if it were possible to choose a group of some of the integer, beginning at a pre-determined start index, such that the group sums to the given target? However, the additional constraint that all 6's must be chosen was added by Jay-Z since the "G" in G-Eazy looks kind of like a 6.

Input Format

The start index on one line, the array's elements on the next line separated by spaces, the end index on the last line.

Sample Input

SAMPLE INPUT #1
0
5 6 2
8

SAMPLE INPUT #2
0
5 6 2
9

Output Format

Whether or not the group sums to the given target.

Sample Output

SAMPLE OUTPUT #1
true

SAMPLE OUTPUT #2
false




You must be logged in to submit a solution.